package com.laolei.test;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import com.laolei.core.cache.MethodCache;
import com.laolei.test.api.YoudaoApi;
import com.laolei.test.api.model.YouDaoBasic;
import com.laolei.test.api.model.YoudaoRelust;

@SpringBootApplication
public class SpringRestClientConfigApplication implements CommandLineRunner {

	public static void main(String[] args) {
		SpringApplication.run(SpringRestClientConfigApplication.class, args);
	}

	@Autowired
	YoudaoApi youdaoApi;

	@Override
	@MethodCache
	public void run(String... args) throws Exception {
		// String key = "922853504";
		// String keyfrom = "rreeee";
		String key = "905632735";
		String keyfrom = "test12343534534";
		YoudaoRelust<YouDaoBasic> yd = youdaoApi.fanyi("good", keyfrom, key, "data", "json");
		System.err.println(yd.toJSONString());
		youdaoApi.fanyi1("good", keyfrom, key, "data", "json");
		for (int i = 0; i < 10; i++) {
			System.err.println(i);
			youdaoApi.fanyi1("good", keyfrom, key, "data", "json");
		}
		YouDaoBasic str = youdaoApi.fanyi1("good", keyfrom, key, "data", "json");
		System.err.println(str.toJSONString());
	}
}
